package com.xz.knowledgeDuplication.pattern.command;

import lombok.AllArgsConstructor;

import java.util.Map;
import java.util.Set;

/**
 * 具体命令角色
 *
 * @author 召
 * @date 2022-03-23 22:12:47
 */
@AllArgsConstructor
public class OrderCommand implements Command{

    /**
     * 高级厨师(接收者角色)
     */
    private SeniorChef receive;

    private Order order;

    @Override
    public void execute() {
        System.out.println(order.getDiningTable() + "桌的订单:");
        Map<String, Integer> foodDic = order.getFoodDic();
        Set<String> names = foodDic.keySet();
        for (String name : names) {
            receive.makeFood(name, foodDic.get(name));
        }
        System.out.println(order.getDiningTable() + "桌的订单准备完成!");
    }
}
